// 积分管理相关API
// 注意：这些方法需要在Vue组件中通过this.$axios调用
export default {
  // 获取用户积分列表
  getUserPointsList(axios, params) {
    return axios.get('/v1/points/users', { params })
  },

  // 获取用户积分统计
  getUserPointsStats(axios, userId) {
    return axios.get(`/v1/points/user/${userId}/stats`)
  },

  // 获取用户积分记录
  getUserPointsRecords(axios, userId, params) {
    return axios.get(`/v1/points/user/${userId}/records`, { params })
  },

  // 调整用户积分
  adjustUserPoints(axios, data) {
    return axios.post('/v1/points/adjust', data)
  },

  // 增加积分
  addPoints(axios, data) {
    return axios.post('/v1/points/add', data)
  },

  // 扣除积分
  deductPoints(axios, data) {
    return axios.post('/v1/points/deduct', data)
  },

  // 获取积分记录详情
  getPointsRecordDetail(axios, recordId) {
    return axios.get(`/v1/points/record/${recordId}`)
  },

  // 检查积分余额
  checkPointsBalance(axios, userId, requiredPoints) {
    return axios.get(`/v1/points/user/${userId}/check-balance`, {
      params: { requiredPoints }
    })
  },

  // 获取用户当前积分余额
  getCurrentBalance(axios, userId) {
    return axios.get(`/v1/points/user/${userId}/balance`)
  },

  // 根据订单ID查询积分记录
  getRecordsByOrderId(axios, orderId) {
    return axios.get(`/v1/points/order/${orderId}/records`)
  }
}
